Repository navigation
refactor: Rename algo to algorithm in page_rank(), feedback_arc_set() and feedback_vertex_set() - #2859
Conversation
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 12230f8 is merged into main:
|
12230f8 to
3072632
Compare
|
Reviewed the rename itself and it looks correct: no drift in the generated blocks, no stale I did find one regression in the generated ambiguity guard, fixed in 47d1fa6. The bug
page_rank(g, alg = "arpack") # soft deprecation before, hard error after
feedback_arc_set(g, alg = "exact_ip") # newly guarded by this PRThe error message was also factually wrong ("matches multiple arguments of The fixA prefix is ambiguous only when the names it matches resolve to different targets, so the predicate now dedupes on hits <- startsWith(names, p)
length(unique(entry$match_to[hits])) > 1LRegenerating narrows or drops four guards, and keeps the ones that matter:
Test changes
Full suite green locally: 9311 pass, 0 fail. I kept this in the same PR rather than splitting it: the bug only becomes user-visible through this rename, and the fix changes these three functions' generated blocks, so a separate PR would leave this one mergeable-but-broken and need a rebase on the generated code anyway. |
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 47d1fa6 is merged into main:
|
| @@ -42,7 +44,7 @@ page.rank <- function( | |||
| lifecycle::deprecate_warn("2.0.0", "page.rank()", "page_rank()") | |||
There was a problem hiding this comment.
When will we get rid of those functions? Could we try deprecate_stop() in a PR? They're dead weight we're carrying around.
There was a problem hiding this comment.
lets do a separate PR that removes those wrappers for good :)
| Condition | ||
| Warning: | ||
| Calling `page_rank()` with positional or abbreviated arguments was deprecated in igraph 3.0.0. | ||
| i Detected call: page_rank(graph, algo) |
There was a problem hiding this comment.
| i Detected call: page_rank(graph, algo) | |
| i Detected call: page_rank(graph, algo = ) |
I wish this looked like this so that the two lines might have real parallelism.
There was a problem hiding this comment.
algo = in the given case, but algo if called with a positional argument?
| }) | ||
|
|
||
| test_that("ambiguous_tags() only flags prefixes with distinct targets", { | ||
| generator <- testthat::test_path("..", "..", "tools", "generate-migrations.R") |
There was a problem hiding this comment.
| generator <- testthat::test_path("..", "..", "tools", "generate-migrations.R") | |
| generator <- test_path("..", "..", "tools", "generate-migrations.R") |
| generator <- testthat::test_path("..", "..", "tools", "generate-migrations.R") | ||
| skip_if_not(file.exists(generator)) | ||
| gen_env <- new.env() | ||
| sys.source(generator, envir = gen_env) |
There was a problem hiding this comment.
could we have something simpler?
There was a problem hiding this comment.
Side notes: tools/ is special, this is what is available to the ./configure scripts.
Did we move the generator from R/ in the past? Why? If we test it, it could well be a file in R/ and rbuildignore-d (alongside the test file).
…c_set()` and `feedback_vertex_set()` (#2788, #526) The legacy `algo` spelling is recovered by the generated ARG_HANDLE blocks and soft-deprecated; abbreviations of both spellings are guarded as ambiguous. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RTPj4qNv2FWui6etixZeuR
`ambiguous_tags()` charmatched a candidate prefix against `match_names`, so any rename whose old name is a prefix of the new one (`algo` -> `algorithm`) flagged `a`, `al` and `alg` as ambiguous even though both candidates resolve to the same argument. Those calls used to work with a soft deprecation and hard-errored instead, with a message that was factually wrong. Dedupe on `match_to` so a prefix is ambiguous only when the names it matches resolve to different arguments of the new API. Regenerating narrows the `page_rank()` guard to `d` (`damping` vs `directed`, a real ambiguity), drops the guards from `feedback_arc_set()` and `feedback_vertex_set()` entirely, and also drops the same latent false positive from `migration_fixture()` (`weight` -> `weights`). `migration_fixture_shadow()` keeps rejecting `at =`, where the two candidates really do have distinct targets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
47d1fa6 to
d010bfd
Compare
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if d010bfd is merged into main:
|
…agents-faw1t1 # Conflicts: # tests/testthat/test-migration-fixture.R
… after merging main Part of #2788. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if b44ae03 is merged into main:
|
# Conflicts: # R/centrality.R # R/structural-properties.R
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The generator-level tests repeated the same lookup, skip and `sys.source()` of tools/generate-migrations.R; `migration_generator_env()` in helper-migrations.R now does that once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if e508e36 is merged into main:
Further explanation regarding interpretation and methodology can be found in the documentation. Last updated for commit e508e36. |
# Conflicts: # R/centrality.R # R/structural-properties.R
… name A head argument renamed in its slot keeps its old name as a `deprecated()` formal. A call that passes that name was written against the old signature, but base R binds its later positional values against the new one: `set_vertex_attr(g, "x", index = i, v)` hands `v` to `vertices`. The generator now reads such renames off the registry and emits a block that matches the whole call against the old signature again, binds each value to its new name lazily, and deprecates each old name, so hand-written bridges are no longer needed. Registry entries may also omit `...` (rename-only migrations) and name replacement functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… arguments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A registry entry with `passthrough_dots = TRUE` gets the re-match for old head names but no recovery out of `...`, and named arguments the old signature did not know are left to `...`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e head Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R CMD check requires the last formal of a replacement function to be `value`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A function with both a legacy block and a `...` recovery block defined `.old_signature()` twice with different formals, which R CMD check reports as a NOTE. The legacy block now uses `.legacy_signature()`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c_set()` and `feedback_vertex_set()` (igraph#2859) Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: David Schoch <david@schochastics.net> (cherry picked from commit b9afd4d) R-side fix: snapshot the deprecation through expect_snapshot_igraph(), so the flavor's package name is normalized.
…c_set()` and `feedback_vertex_set()` (igraph#2859) Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: David Schoch <david@schochastics.net> (cherry picked from commit b9afd4d) R-side fix: snapshot the deprecation through expect_snapshot_igraph(), so the flavor's package name is normalized. R-side fix: air wraps the snapshot line that expect_snapshot_igraph() made too long.
Part of #2788 (PR 1 of the stack, least controversial first); implements the
algo→algorithmleg of #526.What this does
Renames the
algoargument toalgorithminpage_rank(),feedback_arc_set()andfeedback_vertex_set()— the three functions the Comprehensive plan: argument renames for 3.0.0 #2788 survey lists under thealgospelling. All three already carry their 3.0.0 keyword-only migration entries withalgoafter..., so the rename is a pure registry change (algo = algorithmbare-symbol rename intools/migrations/), and legacyalgo =callers are recovered with the same single soft-deprecation as positional callers:Abbreviations that could mean either spelling (
a,al,alg) are rejected as ambiguous by the regenerated ARG_HANDLE guards.The deprecated
page.rank()wrapper keeps its frozenalgoformal (now documented locally with a deprecated badge, since@inheritParams page_rankno longer carries it) and forwards toalgorithm.Tests: named uses updated, plus new coverage that the legacy name is recovered (snapshot for
page_rank(algo = ),expect_deprecatedfor the two feedback functions).Since the stack was opened,
mainhas been merged in, the migration blocks have been regenerated, and the deprecation snapshots now go throughexpect_snapshot_igraph()(the package-name normalization from #2938).Generator support for head renames
This PR also extends
tools/generate-migrations.Rso that renames of head arguments (those before...) are generated from the registry instead of being written by hand in each function. The later PRs of the stack use it.iofoldhas a different name from slotiofnew's head. The old name stays innewas a trailingdeprecated()formal, so positional calls are unchanged and silent.set_vertex_attr(g, "x", index = i, v)still givesvtovalue. A hand-written bridge cannot do that (it putvintovertices), and three reverse dependencies (CurricularComplexity, martini, miloR) broke on that pattern in a revdep run of the stack....(rename only).passthrough_dots = TRUEmarks functions that pass...on (fit_power_law(),local_scan()); there, named arguments the old signature did not know are left to.... Replacement functions such as`vertex_attr<-`can be registered.R/migration-fixture.R, with tests intest-migration-fixture.Randtest-generate-migrations.R, cover each case.tools/migrations/README.mddocuments them.Functions without a registry entry keep their hand-written bridges, 35 across the stack.
Out of scope
method(12 algorithm-choice + 2 comparison-metric functions),implementation(2) andimpl(1) are the open "algorithm family" question of #2788, now tracked in #2932, and are not touched here.The #2788 stack
Each PR is based on the previous one and merges in this order:
algotoalgorithminpage_rank(),feedback_arc_set()andfeedback_vertex_set()#2859:algo→algorithm← this PRnodestonin generators andcentr_*_tmax()#2860:nodes→n(vertex counts)cluster_infomap()#2861: weights argumentsnormalized#2862: normalization flags →normalizedverticesandvertex#2864: selectors →vertices/vertexedges#2943: edge selectors →edgesindextovertices/edgesin the attribute accessors #2944: attribute accessors:index→vertices/edgesn_iter/max_iter#2945: iterations →n_iter/max_iterMu→mu)algorithmand measure selection tomeasure#2951: algorithm family →algorithm/measure(closes Algorithm-selection argument names: census ofmethod/algorithm/algo/impl/implementation#2932)🤖 Generated with Claude Code
https://claude.ai/code/session_01RTPj4qNv2FWui6etixZeuR
Generated by Claude Code